const state = {
  addData: [],
  addDialogEchoData: []
}
const mutations = {
  // 添加addData
  CHANGEADDDATA(state, value) {
    state.addData.push(value)
  },
  // 删除addData
  CHANGEDELDATA(state, value) {
    if (state.addData.length > 0) {
      state.addData = state.addData.filter((i) => {
        return i.columnName != value
      })
    }
  },

  CHANGECLEAN(state, value) {
    state.addData = []
  },
  //  改变dialogData数据
  HANDLECHANGEDATA(state, { index, value }) {
    state.addDialogEchoData[index] = value
  },

  // 添加dialogEchoData
  ADDDIALOGECHODATA(state, value) {
    state.addDialogEchoData.push(value)
  },
  //  删除dialogEchoData
  DELDIALOGECHODATA(state, value) {
    if (state.addData.length > 0) {
      state.addDialogEchoData = state.addData.filter((i) => {
        return i.formData.fieldName != value
      })
    }
  },
  //   清空dialogEchoData
  CLEANDIALOGECHODATA(state) {
    state.addDialogEchoData = []
  }
}
export default {
  namespaced: true,
  state,
  mutations
}
